library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.numeric_std.all;


entity cmp is
generic (N : integer := 32);
port(	CMP_DFF	: in   std_logic_vector (N-1 downto 0);
		CMP_LT	: out std_logic;
		CMP_EQ	: out std_logic;
		CMP_GT	: out std_logic
);
end cmp;

architecture Behavioral of cmp is
signal diff : signed (N-1 downto 0);
signal lessthan, greaterthan, equal : STD_LOGIC; 
begin

diff 			<= signed(CMP_DFF);				-- convert data in signed integer
lessthan		<= '1' when DIFF(N-1) = '1' else '0';	-- if data < 0 first op is smaller
greaterthan	<= not(lessthan) and not(equal);	-- if data > 0 first op is bigger
equal		<= '1' when diff = 0 else '0';		-- if data is 0 they are equal

CMP_LT	<= lessthan;
CMP_GT	<= greaterthan;
CMP_EQ	<= equal;

end Behavioral;
